<?php
use backend\assets\AgentAsset;
use yii\helpers\Html;
use yii\widgets\LinkPager;

AgentAsset::register($this);
?>
<style>
	.page_tab .pagination{
		left: 0;
	}
	.table > tbody + tbody{
		border: 0;
	}
	.main-con{
		width: 100%;height: 400px;overflow-y: auto;
	}
	@media (max-width: 1366px) and (min-width: 900px){
		.main-con {
			height: 300px;
		}
	}
</style>
<div class="main">
		<!-- 搜索  -->
		<div class="tab_cke">
			<form class="form-inline" role="form" action="" method="get">
			<input type="hidden" name="type" value="<?=$type ?>"/>
			  <div class="form-group">
				  <label class="" for="">供应商:</label>
				  <input class="form-control" type="text" name="supplier" id="" value="<?=$supplier ?>" />
			  </div>
			  <div class="form-group">
				  <label class="mg20-x" for="">条形码:</label>
				  <input class="form-control" type="text" name="bar_code" id="" value="<?=$bar_code ?>" />
			  </div>
			  <div class="form-group">
				  <label class="mg20-x" for="">商品名称:</label>
				  <input class="form-control" type="text" name="repertory_name" id="" value="<?=$repertory_name ?>" />
			  </div>
				<button type="submit" class="btnBg btn-default ml20">搜 索</button>
			</form>
		</div>
		<div class="clearfix"></div>
		<?php //Pjax::begin();?>

	<div class="main-con">
		<?php if(empty($data)){?>
		<table class="table table-bordered">
			<thead>
			<tr>
				<th>选择</th>
				<th>商品名称</th>
				<th>规格</th>
				<th>库存</th>
				<th>供应商</th>
				<th>品牌</th>
				<th>系列</th>
				<th>类别</th>
			</tr>
			</thead>
			<tbody>
			<tr>
				<td colspan="8" align="center"><img src="<?=Yii::getAlias('@web/backend/img/nodata.gif');?>"></td>
			</tr>
			</tbody>
		</table>
		<?php }else{?>
		<table class="table table-bordered">
			<thead>
			<tr>
				<th>选择</th>
				<th>商品名称</th>
				<th>规格</th>
				<th>库存</th>
				<th>供应商</th>
				<th>品牌</th>
				<th>系列</th>
				<th>类别</th>
			</tr>
			</thead>
			<input type="hidden" class="type" value="<?=$type ?>"/>
			<?php foreach ($data as $d) {?>
			<tbody>
			<tr>
				<td>
					<input type="checkbox" value="<?=$d['repertory_id'] ?>" <?php if(in_array($d['repertory_id'], $repertory_ids)){?>checked="checked"<?php }?> style="display: block;"/>
				</td>
				<td><?=Html::encode($d['repertory_name'])?></td>
				<td><?=Html::encode($d['repertory_specs'])?></td>
				<td><?=Html::encode($d['repertory_count'])?></td>
				<td><?=Html::encode($d['supplier_name'])?></td>
				<td><?=Html::encode($d['repertory_brand'])?></td>
				<td><?=Html::encode($d['repertory_series'])?></td>
				<td><?=Html::encode($d['repertory_category'])?></td>
			</tr>
			</tbody>
			<?php }?>
		</table>
	</div>
		<?php }?>
			<div class="count count_tab">
				已选择<em><?=$count ?>件</em>商品
			</div>
			<div class="page page_tab">
				<?=LinkPager::widget([
						'pagination' => $page,
						'hideOnSinglePage' => true
				]); ?>
			</div>

			<?php //Pjax::end();?>
	</div>
	<div class="button_tab">
		<button type="" class="ok btnBg">确定</button>
		<button type="" class="btnBg bg_rest cancel_one">取消</button>
	</div>
<?php $this->registerJsFile("@web/system/repertory/list.js",['position'=>$this::POS_END]);?>
	
